package com.huluobo.document

import com.huluobo.document.entity.DocumentEntity
import com.huluobo.lib_base.Res
import com.huluobo.lib_http.Const
import kotlinx.coroutines.flow.Flow
import okhttp3.MultipartBody
import retrofit2.http.GET
import retrofit2.http.Multipart
import retrofit2.http.POST
import retrofit2.http.Part
import retrofit2.http.Query

/**
 *  Created by LC on 2025/5/27.
 */
interface ApiService {
    @GET(Const.URL_GET_DOCUMENT)
    fun getDocuments(): Flow<Res<DocumentEntity>>

    //使用文件上传的Part,需要多添加一个注解,标记当前方法上传的是一个Part
    @Multipart
    @POST(Const.URL_UPLOAD_DOCUMENT)
    fun uploadDocument(
        @Part data: List<MultipartBody.Part>,
        @Query(Const.PARAM_INFO) info: String,
        @Query(Const.PARAM_TYPE) type: String,
        @Query(Const.PARAM_RES_TYPE) resType: String
    ): Flow<Res<Any>>

    @GET(Const.URL_DELETE_DOCUMENT)
    fun deleteDocument(@Query(Const.PARAM_ID) id: Int): Flow<Res<Any>>
}